<?php


namespace Part18_MemoMode\Code1;


class GameRole
{
    // 生命力
    private $vitality;
    // 攻击力
    private $attack;
    // 防御力
    private $defense;

    public function getVitality()
    {
        return $this->vitality;
    }

    public function setVitality($vitality)
    {
        $this->vitality = $vitality;
    }

    public function getAttack()
    {
        return $this->attack;
    }

    public function setAttack($attack)
    {
        $this->attack = $attack;
    }

    public function getDefense()
    {
        return $this->defense;
    }

    public function setDefense($defense)
    {
        $this->defense = $defense;
    }

    // 状态显示
    public function StateDisplay()
    {
        echo "角色当前状态：\n";
        echo "体力：{$this->vitality}\n";
        echo "攻击力：{$this->attack}\n";
        echo "防御力：{$this->defense}\n";
        echo "\n";
    }

    // 初始状态
    public function GetInitState()
    {
        $this->vitality = 100;
        $this->attack = 100;
        $this->defense = 100;
    }

    // 打完boss直接死了
    public function Fight()
    {
        $this->vitality = 0;
        $this->attack = 0;
        $this->defense = 0;
    }
}